//
//  ZWBaseTableViewCell.m
//  WanEr
//
//  Created by 高文萍 on 15/12/29.
//  Copyright © 2015年 高文萍. All rights reserved.
//

#import "ZWBaseTableViewCell.h"
#import "ZWCutyDetailCVCell.h"
#import "WanErHeader.h"
#import "ZWHomeModel.h"
#import "playerWebVC.h"
@implementation ZWBaseTableViewCell

- (void)createData
{
    [self.baseCollection reloadData];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.baseCollection = [[ZWBaseCollecView alloc]initWithFrame:CGRectZero flowLayoutItemSize:CGSizeMake((WIDTH - 15 * 4) / 3, (WIDTH - 15 * 4) / 3) xSpace:0 ySpace:0 sectionInset:UIEdgeInsetsMake(15, 15, 15, 15) cell:[ZWCutyDetailCVCell class] reuse:@"reuse"];
        self.baseCollection.delegate = self;
        self.baseCollection.dataSource = self;
        [self.contentView addSubview:self.baseCollection];
        
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.baseCollection.frame = CGRectMake(0, 0, WIDTH, (WIDTH - 15 * 4) / 3 + 30);
    
    // 关掉显示垂直的进度条
    self.baseCollection.showsVerticalScrollIndicator = NO;
    // 关掉显示水平的进度条
    self.baseCollection.showsHorizontalScrollIndicator = NO;
    
}


- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return self.arr.count;
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    ZWCutyDetailCVCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"reuse" forIndexPath:indexPath];
    
    [cell.city_imag sd_setImageWithURL:[NSURL URLWithString:((ZWHomeModel *)self.arr[indexPath.row]).image_url]];
    cell.city_label.text = ((ZWHomeModel *)self.arr[indexPath.row]).scenerie_name;
    cell.layer.borderColor = [UIColor colorWithRed:0.680 green:0.638 blue:0.396 alpha:1.000].CGColor;
    cell.layer.borderWidth = 0.3;
    return cell;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    self.uId = ((ZWHomeModel *)self.arr[indexPath.row]).equipId;
    NSDictionary *dic = @{@"id":self.uId};
    [[NSNotificationCenter defaultCenter]postNotificationName:@"tagValue" object:nil userInfo:dic];
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
